package st.business.tepth.business.user.busnumber.workholder.repair.finish;

import java.util.ArrayList;
import java.util.List;

import st.business.tepth.business.bean.CompleteInfoBean;
import st.business.tepth.business.bean.MaintainPassInfoBean;
import st.business.tepth.config.ItemFields;
import st.shadow.library.ui.recycler.MultipleItemEntity;

/**
 * @author zhangyu
 * @date 2019/3/26
 */
public class RepairCompleteDataConvert {
    public static List<MultipleItemEntity> convert(CompleteInfoBean completeInfoBean) {
        List<MultipleItemEntity> list = new ArrayList<>();
        ArrayList<CompleteInfoBean.Info> infos = completeInfoBean.getCompleteList();
        if (infos != null) {
            for (CompleteInfoBean.Info info : infos) {
                list.add(MultipleItemEntity.builder().setItemType(
                        RepairCompleteAdapter.TYPE_2)
                        .setField(ItemFields.ITEM_OBJ, info)
                        .build());
            }
        }
        return list;
    }

    public static List<MultipleItemEntity> convertToClassification(CompleteInfoBean completeInfoBean) {
        List<MultipleItemEntity> list = new ArrayList<>();
        ArrayList<CompleteInfoBean.Info> infos = completeInfoBean.getCompleteList();
        if (infos != null) {
            for (CompleteInfoBean.Info info : infos) {
                MaintainPassInfoBean maintainPassInfoBean = new MaintainPassInfoBean();
                maintainPassInfoBean.setRepairTaskId(info.getId());
                maintainPassInfoBean.setVehicleSeriesName(info.getVehicle_series_name());
                list.add(MultipleItemEntity.builder()
                        .setField(ItemFields.ITEM_OBJ, maintainPassInfoBean)
                        .setField("isChecked", false)
                        .build());
            }
        }
        return list;
    }
}
